import CONSTANT from '@/common/constants.js';
import http from '@/common/http.js';
import Calendar from '../calendar/index.js';

export default {
  name: 'myClass',
  components: {
    Calendar
  },
  data () {
    return {
      studentId: '',
      studentName: '',
      siteId: '',
      keyWords: '',
      status: '',
      pageNo: 1,
      content: [],
      content: {},
      currentDate:''
    }
  },
  mounted () {
    var _this = this
    _this.siteId = window.sessionStorage.getItem('siteId')
    _this.studentId = window.sessionStorage.getItem('studentId')
  },
  created() {
    function format(date, index) {
      date = new Date(date);
      return `${date.getFullYear()}-${date.getMonth() + 1}-${index}`;
    }
  },
  methods: {
    goList () {
      var _this = this
      http.get(CONSTANT.STUDENTSCHEDULE + '?studentId=' + _this.studentId + '&siteId=' + _this.siteId + '&currentDate=' + _this.currentDate, {
      }, (res) => {
        console.log(res)
    })
    },
    comeBack () {
      window.history.go(-1)
    },
    clickDay(data) {
      var reg = new RegExp( '/' , "g" )
      this.currentDate = data.replace(reg,"-")
      this.goList()
    },
    clickToday(data) {
      console.log('跳到了本月今天', data); //跳到了本月
    },
    changeDate(data) {
      console.log('左右点击切换月份', data); //左右点击切换月份
    }
  }
}
